﻿#include "OperatorsSpectraForce.h"

#include "GUIDialog/GUIPhyscisDialog/GUISpectraForceDialog.h"
#include "GUIDialog/GUIPhyscisDialog/GUISpectraEditNotesDialog.h"

#include "FITK_Component/FITKAcousticsPhysics/FITKAcousticsPhysics.h"
#include "FITK_Component/FITKAcousticsPhysics/FITKAcousticsSpectraManager.h"

namespace OperModel
{
    OperatorsSpectraForce::OperatorsSpectraForce()
    {
        //获取频谱管理器
        Acoustics::FITKAcousticsPhysics* phy = Acoustics::FITKAcousticsPhysics::GetAcousticsPhysicsFromFrame();
        if (phy == nullptr) return;
        _spectraManager = phy->getFITKAcousticsSpectraManager();
    }

    void OperatorsSpectraForce::createSpectra()
    {
        GUI::GUISpectraForceDialog* dialog = new GUI::GUISpectraForceDialog(-1, true);
        dialog->show();
    }

    void OperatorsSpectraForce::duplicateSpectra(const int id)
    {

    }

    void OperatorsSpectraForce::editSpectra(const int id)
    {
        GUI::GUISpectraForceDialog* dialog = new GUI::GUISpectraForceDialog(id, false);
        dialog->show();
    }

    void OperatorsSpectraForce::removeSpectra(const int id)
    {
        if (_spectraManager == nullptr)return;
        _spectraManager->removeDataByID(id);
    }

    void OperatorsSpectraForce::editNotes(const int id)
    {
        GUI::GUISpectraEditNotesDialog* dialog = new GUI::GUISpectraEditNotesDialog(id);
        dialog->show();
    }
}